import 'package:earclean/app/config/colors.dart';
import 'package:earclean/app/modules/widget/app_bar_widget.dart';
import 'package:earclean/app/modules/widget/login_button.dart';
import 'package:earclean/app/routes/app_pages.dart';
import 'package:earclean/app/util/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../controllers/payend_controller.dart';

class PayendView extends GetView<PayendController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const AppBarWidget(
          backgroundColor: ColorConfig.white, titleStr: '订单支付'),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          SizedBox(height: 64.h),
          Image.asset(
            'assets/images/payend.png',
            width: 120,
          ),
          SizedBox(height: 23),
          Text('支付成功！',
              style: TextStyle(
                fontSize: 18.sp,
                color: ColorConfig.text_label,
                fontWeight: FontWeight.bold,
              )),
          SizedBox(height: 23),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('实付',
                  style: TextStyle(
                    fontSize: 16.sp,
                    color: ColorConfig.text_label,
                    fontWeight: FontWeight.bold,
                  )),
              Obx(() => Text(' ${controller.price}元',
                  style: TextStyle(
                    fontSize: 16.sp,
                    color: Colors.red,
                    fontWeight: FontWeight.bold,
                  ))),
              Obx(() =>
                  Text(controller.paytype.value == 2 ? '，微信支付 ' : "，支付宝支付 ",
                      style: TextStyle(
                        fontSize: 16.sp,
                        color: ColorConfig.text_label,
                        fontWeight: FontWeight.bold,
                      ))),
            ],
          ),
          SizedBox(height: 60),
          Container(
            width: 1.sw,
            height: 45,
            margin: EdgeInsets.symmetric(horizontal: 30.w),
            child: LoginButton(
              "确定",
              enable: true,
              onPressed: () {
                // Get.until((route) => route.settings.name == Routes.TABLE);
                 Get.until((route) => route.settings.name == Routes.TABLE);
                Get.toNamed(Routes.WEB, arguments: {
                  "title": '订单',
                  "url": box.read('my_need_url'),
                });
              },
            ),
          ),
        ],
      ),
    );
  }
}
